package com.heiye.comment.biz.constant;

/**
 * @author: heiye
 * @date: 2025/07/30 下午9:18
 * @version: v1.0.0
 * @description: Redis 常量类
 */
public class RedisKeyConstants {
    /**
     * Key 前缀：评论分页 ZSET
     */
    private static final String COMMENT_LIST_KEY_PREFIX = "comment:list:";

    /**
     * Key 前缀：评论详情 JSON
     */
    private static final String COMMENT_DETAIL_KEY_PREFIX = "comment:detail:";

    /**
     * Key 前缀：Roaring Bitmap - 用户点赞的评论
     */
    private static final String R_BITMAP_COMMENT_LIKES_KEY_PREFIX = "rbitmap:comment:likes:";

    /**
     * Key 前缀：最佳评论
     */
    private static final String COMMENT_BEST_KEY_PREFIX = "comment:best:";


    /**
     * 构建 Roaring Bitmap - 用户点赞的评论 完整 KEY
     *
     * @param userId
     * @return
     */
    public static String buildRBitmapCommentLikesKey(Long userId) {
        return R_BITMAP_COMMENT_LIKES_KEY_PREFIX + userId;
    }

    /**
     * 构建评论详情完整 KEY
     *
     * @param commentId
     * @return
     */
    public static String buildCommentDetailKey(Object commentId) {
        return COMMENT_DETAIL_KEY_PREFIX + commentId;
    }

    /**
     * 构建评论分页 ZSET 完整 KEY
     *
     * @param quizId
     * @return
     */
    public static String buildCommentListKey(Long quizId) {
        return COMMENT_LIST_KEY_PREFIX + quizId;
    }

    /**
     * 构建最佳评论 KEY
     *
     * @param quizId
     * @return
     */
    public static String buildCommentBestKey(Long quizId) {
        return COMMENT_BEST_KEY_PREFIX + quizId;
    }
}
